<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script type="text/javascript" src="js/react.development.js"></script>
    <script type="text/javascript" src="js/react-dom.development.js"></script>
    <script type="text/javascript" src="js/babel.min.js"></script>
    <style>
        .sty01{
            color: pink;
            font-size: 20px;
        }
    </style>
</head>
<body>
    <div id="root">
    
    </div>
    <script type="text/babel">
        let num = 11;
        let str = 'hello world!';
        // 字符串倒序的方法借用数组reverse方法
        function reverseFn(str) {
            return str.split('').reverse().join('');
        };
        let isOk = false;

        let ojsx = (
            <div>
                <h1>we are family</h1>
                <p>{num + 5}</p>
                <p>{str.split('').reverse().join('')}</p>
                <p>{reverseFn(str)}</p>
                <p>{isOk ? 'YES' : 'NO'}</p>
                <p>{num === 11 ? 'equal' : 'notequal'}</p>
                {/*注意jsx结构里面的注释写法；任何元素都需要有伪标签，无论单标签或者双标签*/}
                <img src="https://ss1.bdstatic.com/70cFvXSh_Q1YnxGkpoWK1HF6hhy/it/u=3363295869,2467511306&fm=26&gp=0.jpg" alt=""/>
                {/*类名className*/}
                <p className="sty01">添加了样式1</p>
                {/*行内样式必须以对象的形式来定义，双大括号，外插入变量对象，内即对象*/}
                <p style={{color:'red',fontSize:'30px'}}>使用了行内样式</p>
            </div>
        );

        ReactDOM.render(ojsx, document.getElementById('root'));
    </script>
</body>
</html>